package model;
import java.sql.*;

import java.util.*;

import javax.naming.NamingException;

import db.DbConnectionPool;
import db.DbException;



public class CountryModel {
	private static String insertStr = "SELECT * FROM Countries order by id";
	public static Vector<String> getCountries() throws DbException{
		try{
		Connection conn = DbConnectionPool.getConnection();
		Statement stmt = conn.createStatement();
		ResultSet rs = stmt.executeQuery(insertStr);
		
		Vector<String> countries = new Vector<String>();
        while (rs.next()) {
                countries.add(rs.getString(2));
        }

        rs.close();
        stmt.close();
        conn.close();
        return countries;
        
		} catch (SQLException ex) {
            throw new DbException(ex);
		} catch (NamingException ex) {
			throw new DbException(ex);
		}
	}
}






